<!--  -->
<template>
    <div class="box">
        <div class="title">待维修处理</div>

        <div v-for="(item, index) in list" :key="item.id" class="item" :title="item.address + ':' + item.content">
            <label>{{ index + 1 }}、</label>
            <el-button link type="primary">{{ item.address }}：</el-button>
            <span>{{ item.content }}</span>
        </div>

    </div>
</template>

<script lang='ts' setup>
import { getList } from '../../service/repairs/repairs'
import { RepairParams } from '../../service/repairs/type'
import { reactive, toRefs, ref, onMounted } from 'vue'

//返回的数据列表
const state = reactive<any>({
    params: {
        page: 1,
        psize: 5,
        state: 1
    },
    list: []
})

 const {params,list}= toRefs(state);  //对象所有的属性都转成 ref对象；

// const list = toRef(state, "list");  //将 对象的某个属性  转成ref对象
// const params = toRef(state, "params");

//请求未处理的报修信息
const getData = async () => {

    const res: any = await getList(params.value);
    if (res.errCode === 10000) {

        list.value = res.data.list;
    }

}
//挂载生命周期函数
onMounted(() => {
    getData();
})

</script>
<style scoped lang="less">
.box {
    height: auto;
    width: 300px;
    background-color: #fff;
    box-shadow: 0 2px 12px #0000001a;
    margin-bottom: 20px;
    padding: 20px;
    box-sizing: border-box;


}

.title {
    font-size: 13px;
    margin-bottom: 10px;
}

.item {
    height: 32px;
    line-height: 32px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;

}
</style>